chore: backfill email-domain member organization dates (CM-1107)#4061
chore: backfill email-domain member organization dates (CM-1107)#4061skwowet merged 1 commit intoimprove/CM-1105from
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a one-off operational backfill to infer and populate missing dateStart/dateEnd for existing email-domain member-organization rows, using verified email identities + activity relations as evidence and reusing existing stint inference logic.
Changes:
- Extend data-access-layer with queries to (a) page through members with undated
email-domainorg rows and (b) fetch per-org activity-date evidence derived from verified email identities. - Add a backend CLI script to run the backfill, apply inferred inserts/updates in transactions, and enqueue affected members for affiliation recalculation via Redis.
- Update the script-executor worker’s Redis set key used for member affiliation recalculation.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/libs/data-access-layer/src/members/types.ts | Adds a typed shape for activity-date evidence used by the new DAL query. |
| services/libs/data-access-layer/src/members/organizations.ts | Introduces DAL fetchers for undated email-domain members and their activity-date evidence. |
| services/apps/script_executor_worker/src/activities/block-project-organization-affiliations.ts | Switches the Redis set key used to queue/drain members for affiliation recalculation. |
| backend/src/bin/scripts/backfill-email-domain-member-organization-dates.ts | New one-off backfill script to infer/apply date ranges and enqueue members for recalculation. |
| backend/package.json | Adds an npm script entry to run the new backfill script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 53b83d3. Configure here.
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>

Summary
Adds a one-off backfill script for existing
email-domainmember organization rows with missing dates.The script:
email-domainmember organizations wheredateStartanddateEndare null.activityRelations.memberId/platform/usernameto find activity-date evidence.Note
Medium Risk
Adds a one-off script that writes to
memberOrganizationsand queues affiliation recalculation, plus changes the Redis set key used for that recalc queue; mistakes could cause incorrect date ranges or missed/duplicated recalcs.Overview
Adds a one-off backfill script to populate missing
dateStart/dateEndfor existingemail-domainmemberOrganizationsby deriving activity-based dates and applying the existing stint-inference logic, then enqueuing affected members for affiliation recalculation.Extends the data-access layer with queries to (1) page through members with undated
email-domainorg rows and (2) fetch per-member activity dates via verified email identities +activityRelations. Also standardizes the Redis queue key for affiliation recalculation torecalculate-member-affiliationsand wires the new script intobackend/package.json.Reviewed by Cursor Bugbot for commit 53b83d3. Bugbot is set up for automated code reviews on this repo. Configure here.